package io;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class PWDemo {//缓冲字符流
    public static void main(String[] args) throws IOException {
        PrintWriter pw =new PrintWriter("pw.txt");
        pw.println("形不成形");
        pw.println("意不在意");
        System.out.println("写出完毕");
        pw.close();





       /* FileOutputStream fos =new FileOutputStream("pw.txt");//这是换行写出的底层逻辑,不做日常使用
        OutputStreamWriter osw =new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        BufferedWriter bw =new BufferedWriter(osw);
        PrintWriter pw =new PrintWriter(bw);//换行写出
        pw.write("形不成形");
        pw.write("意不在意");
        System.out.println("写出完毕");
        bw.close();//先调用了flush()冲水*/
    }
}
